/******************************************************************************************
 
Made by www.Flashphoner.com, all rights reserved.
These sources can only be used for working with Flashphoner server.
If you want use this to create your own application (separate from Flashphoner server) � 
please contact support@flashphoner.com 

******************************************************************************************/

package com.flashphoner
{
	
	import flash.system.Capabilities; 
	public class Logger
	{	
		[Bindable]
		/**
		 * String which contain full logs.
		**/
		public static var log:String = new String();
		
		/**
		 * Default constructor
		**/
		public function Logger()
		{
		}
		
		private static function getTime() : String
        {
            var dt : Date = new Date();
            var str : String = 'UTC ' + dt.getUTCMonth() + '.' + dt.getUTCDate() + ' ' + dt.getUTCHours() + ':' + dt.getUTCMinutes() + ':' + dt.getUTCSeconds() + ': ';
            return str;
        }

		/**
		 * Add info message to log and output to trace
		 **/
        public static function info(str : String) : void
        {           
                str = 'INFO:    ' + getTime() + str;
                trace(str);
                log += str + '\n';
            
        }

		/**
		 * Add debug message to log and output to trace
		 **/
        public static function debug(str : String) : void
        {
           
                str = 'DEBUG:   ' + getTime() + str;
                trace(str);
                log += str + '\n';
          
        }

		/**
		 * Add error message to log and output to trace
		 **/
        public static function error(str : String) : void
        {
           
                str = 'ERROR:   ' + getTime() + str;
                trace(str);
                log += str + '\n';
           
        }       

	
	}
}